package ccpc;

import java.util.Scanner;


public class Problem1004 {

	public static void main(String[] args) {

		Scanner cin = new Scanner(System.in);
		int N = cin.nextInt();
		int [] sum = new int[N];
		for(int i = 0; i < N; i++) {
			int M = cin.nextInt();
			for(int j = 0; j < M; j++)
				sum[i]+=cin.nextInt();
		}
		for(int i : sum)
			System.out.println(i);
	}

}